package com.example.aibot.aiHelper.service;

import com.example.aibot.aiHelper.guardrail.SafeInputGuardrail;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.Result;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.guardrail.InputGuardrails;
import reactor.core.publisher.Flux;

import java.util.List;

@InputGuardrails({SafeInputGuardrail.class})
public interface AiCodeService {

    @SystemMessage(fromResource = "system-prompt.txt")
    String chat(String userMessage);

    // 使用静态内部类
    record Report(String name, List<String> suggestionList) {}

    @SystemMessage(fromResource = "system-prompt.txt")
    Report chatForReport(String userMessage);


    /**
     *  chatWithRag 能够实现获取到 RAG 引用的源文档、以及 Token 的消耗情况等等
     * @param userMessage
     * @return
     */
    @SystemMessage(fromResource = "system-prompt.txt")
    Result<String> chatWithRag(String userMessage);

    @SystemMessage(fromResource = "system-prompt.txt")
    Flux<String> chatStream(@MemoryId int memoryId, @UserMessage String userMessage);
}
